<?php

namespace System;

/**
 * Description of Template
 *
 * @author nofear
 */
class Template {
    
    private $_params = array();
    private $_twig;
    private $view;
    
    public function __construct($view) {
        $this->view = $view;
        $this->_twig = \Shared\Application::getInstance()->getTwig();
    }
    
    public function __set($name, $value) {
        $this->_params[$name] = $value;
    }
    
    public function __get($name) {
        return $this->_params[$name];
    }
    
    public function paste() {
        return $this->_twig->render($this->view, $this->_params);
    }
    
    /**
     * 
     * @return \Twig_Template
     */
    public function getTemplate() {
        return $this->_twig->loadTemplate($this->view);
    }
}
